﻿using Microsoft.Xna.Framework.Graphics;

namespace GP2D3D_Homework1_RickBeijer_S1012261
{
    /// <summary>
    /// A custom display mode, containing only the information needed for setting a different display mode.
    /// </summary>
    public class CustomDisplayMode
    {
        private SurfaceFormat pixelDepth;
        private int width;
        private int height;

        public string DeviceName
        {
            get;
            set;
        }

        public string PixelDepth
        {
            get { return pixelDepth.ToString(); }
        }

        public string Resolution
        {
            get { return width + "x" + height; }
        }

        public int RefreshRate
        {
            get;
            set;
        }

        public SurfaceFormat GetPixelDepth()
        {
            return pixelDepth;
        }

        public int GetWidth()
        {
            return width;
        }

        public int GetHeight()
        {
            return height;
        }

        public CustomDisplayMode(string deviceName, SurfaceFormat pixelDepth, int width, int height, int refreshRate)
        {
            this.DeviceName = deviceName;
            this.pixelDepth = pixelDepth;
            this.width = width;
            this.height = height;
            this.RefreshRate = refreshRate;
        }

        public override string ToString()
        {
            return DeviceName + " - " + PixelDepth + " on " + Resolution + " at " + RefreshRate + " Hz";
        }

        /// <summary>
        /// Returns all properties of the display mode as a collection of strings. This can be used to fill a table or list with multiple
        /// columns.
        /// </summary>
        /// <returns>DeviceName - PixelDepth - Resolution (WidthxHeight) - Refreshrate.</returns>
        public string[] ToStringArray()
        {
            return new string[]
                       {
                               DeviceName,
                               PixelDepth,
                               Resolution,
                               RefreshRate.ToString()
                       };
        }
    }
}